import http from '@/utils/http'

const machineApi = '/operation/device'

/** 1 获取当前定位的设备列表-接口 /operation/device/list
 * @param latitude 纬度 number
 * @param longitude 经度 number
 */
export const getMachineListApi = (params) => {
  return http({
    method: 'get',
    url: machineApi + '/list',
    params,
  })
}

/** 2 获取设备详情信息-接口 /operation/device/info
 * @param machineId 设备id string
 */
export const getMachineInfoApi = (params) => {
  return http({
    method: 'get',
    url: machineApi + '/info',
    params,
  })
}

/** 3 获取设备内的排队套餐列表详情-接口 /operation/device/order/queue
 * @param machineId 设备id  string
 * @param phone? 搜索值 string
 */
export const getMachineOrderListApi = (params) => {
  return http({
    method: 'get',
    url: machineApi + '/order/queue',
    params,
  })
}

/** 4 获取订单详情-接口 /operation/device/order/info
 * @param orderId 订单id string
 */
export const getMachineOrderInfoApi = (params) => {
  return http({
    method: 'get',
    url: machineApi + '/order/info',
    params,
  })
}

/** 5 一键恢复-接口  /operation/device/order/make
 * @param orderId 订单id string
 * @param orderDetailId 订单详情id	 string
 *
 */
export const postOrderMakeApi = (data) => {
  return http({
    method: 'post',
    url: machineApi + '/order/make',
    data,
  })
}

/** 7 获取设备内报损数据-接口 /operation/device/damage
 * @param machineId 设备id string
 */
export const getDamageDataApi = (params) => {
  return http({
    method: 'get',
    url: machineApi + '/damage',
    params,
  })
}

/** 8 修改设备报损-接口 /operation/device/damage
 * @param comboId 套餐id string
 * @param comboNum 库存 number
 * @param machineId 设备id string
 * @param roadNumber 货道号 string
 * @param id
 */
export const putDamageDataApi = (data) => {
  return http({
    method: 'put',
    url: machineApi + '/damage',
    data,
  })
}

/**
 * 9 同步投放计划-接口 /operation/device/synchPlan
 * @param machineId 设备id
 *
 */
export const getSynchPlanApi = (params) => {
  return http({
    method: 'get',
    url: machineApi + '/plan/synch',
    params,
  })
}

/**
 * 10 提交同步投放计划-接口 /operation/device/plan
 * @param machineId 设备id
 *
 */
export const postSynchPlanApi = (data) => {
  return http({
    method: 'post',
    url: machineApi + '/plan',
    data,
  })
}

/**
 * 11 查看库存信息-接口 /operation/device/road
 * @param machineId 设备id
 *
 */
export const getRoadInfoApi = (params) => {
  return http({
    method: 'get',
    url: machineApi + '/road',
    params,
  })
}

/**
 * 12 修改库存信息-接口 /operation/device/road
 * @param machineId 设备id
 *
 */
export const putRoadInfoApi = (data) => {
  return http({
    method: 'put',
    url: machineApi + '/road',
    data,
  })
}
